/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package adsreis.com.Outros;

import adsreis.com.acessobd.AcessoMySql;
import java.awt.Image;
import java.awt.Toolkit;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 *
 * @author Pauroenriki
 */
public class BuscaImage {
    String consultaImage = "SELECT IMAGE FROM OUTROS WHERE CODIMAGE LIKE ?";
    PreparedStatement pstm;
    ResultSet rs;
    public Image BuscaImage(Integer cod){
                          
        Image logo;
        Object logo1 = null;
        Toolkit t = Toolkit.getDefaultToolkit();
        
        try{
            AcessoMySql mysql = new AcessoMySql();
           pstm = mysql.conectar().prepareStatement(consultaImage);
           pstm.setInt(1, cod);
           
           
           rs = pstm.executeQuery();
           
           while (rs.next()){
              logo1 = rs.getObject("image");
                 
                  
           }
           
           
           mysql.desconectar();
        }catch (Exception e){
            e.printStackTrace();
        }
        return (Image) logo1;        
    } 
    
    
}
